using System;
using System.Collections.Generic;
using System.Data.Linq.Mapping;
using InfoTech.Core.Data.Attributes;
using InfoTech.Core.Data.Dataable;
using InfoTech.Core.Data.Persistence;
using InfoTech.Utilities.Generic;

namespace InfoTech.LanTranh.MucVu.Bussiness
{
	[Serializable]
	[ExtraTable(Name = "SOTANHIEN", Schema="dbo")]
	[Table(Name = "[dbo].[SOTANHIEN]")]
	public partial class SOTANHIEN : ObjPersistence, IDeleteable, IUpdateable, IInsertable, ISelectable, IDeleteablebyId, IUpdateablebyId, ISelectablebyId
	{

		#region Fields

		private System.Guid _matanhien;

		private System.Guid? _machucvu;

		private System.Guid? _magiaodan;

		private System.String _diadiem;

		private System.String _dongtu;

		private System.String _phucvutai;

		private System.Boolean? _hoituc;

		private System.Int32? _ngay;

		private System.Int32? _thang;

		private System.Int32? _nam;

		private LINHMUC_CHUCVU _prt_linhmuc_chucvu;

		private GIAODAN _prt_giaodan;

		#endregion

		#region Properties

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = false)]
		[Column(Name = "MATANHIEN", DbType = "uniqueidentifier", IsPrimaryKey = true, CanBeNull = false)]
		public System.Guid MATANHIEN
		{
			get
			{
				return _matanhien;
			}
			set
			{
				OnChanged(this, "MATANHIEN");
				_matanhien = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MACHUCVU", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MACHUCVU
		{
			get
			{
				return _machucvu;
			}
			set
			{
				OnChanged(this, "MACHUCVU");
				_machucvu = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAGIAODAN", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAGIAODAN
		{
			get
			{
				return _magiaodan;
			}
			set
			{
				OnChanged(this, "MAGIAODAN");
				_magiaodan = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 1000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "DIADIEM", DbType = "nvarchar(1000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String DIADIEM
		{
			get
			{
				return _diadiem;
			}
			set
			{
				OnChanged(this, "DIADIEM");
				_diadiem = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 1000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "DONGTU", DbType = "nvarchar(1000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String DONGTU
		{
			get
			{
				return _dongtu;
			}
			set
			{
				OnChanged(this, "DONGTU");
				_dongtu = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 1000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "PHUCVUTAI", DbType = "nvarchar(1000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String PHUCVUTAI
		{
			get
			{
				return _phucvutai;
			}
			set
			{
				OnChanged(this, "PHUCVUTAI");
				_phucvutai = value;
			}
		}

		[ExtraColumn(DbType = "bit", Length = 0, TypeName = "System.Boolean", Type = typeof(System.Boolean), CanBeNull = true)]
		[Column(Name = "HOITUC", DbType = "bit", IsPrimaryKey = false, CanBeNull = true)]
		public System.Boolean? HOITUC
		{
			get
			{
				return _hoituc;
			}
			set
			{
				OnChanged(this, "HOITUC");
				_hoituc = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "NGAY", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? NGAY
		{
			get
			{
				return _ngay;
			}
			set
			{
				OnChanged(this, "NGAY");
				_ngay = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "THANG", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? THANG
		{
			get
			{
				return _thang;
			}
			set
			{
				OnChanged(this, "THANG");
				_thang = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "NAM", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? NAM
		{
			get
			{
				return _nam;
			}
			set
			{
				OnChanged(this, "NAM");
				_nam = value;
			}
		}

		public LINHMUC_CHUCVU PRT_LINHMUC_CHUCVU
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_linhmuc_chucvu == default(LINHMUC_CHUCVU)))
					InfoTech.Core.Data.Receiver.TypeObject<LINHMUC_CHUCVU>.Select(this, "PRT_LINHMUC_CHUCVU", new[] { new Vector<string, string>("MACHUCVU", "MACHUCVU"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_linhmuc_chucvu;
			}
			set
			{
				_prt_linhmuc_chucvu = value;
			}
		}

		public GIAODAN PRT_GIAODAN
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_giaodan == default(GIAODAN)))
					InfoTech.Core.Data.Receiver.TypeObject<GIAODAN>.Select(this, "PRT_GIAODAN", new[] { new Vector<string, string>("MAGIAODAN", "MAGIAODAN"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_giaodan;
			}
			set
			{
				_prt_giaodan = value;
			}
		}

		#endregion

		#region Reflector

		public System.Type Reflector()
		{
			return typeof(SOTANHIEN);
		}
		public object Current
		{
			get { return this; }
		}

		#endregion

	}
}
